package mvc.enhancedElicoide;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;

import org.geom.curve.ICurve;
import org.render.IRenderer;

import mvc.controller.MouseController;
import mvc.elicoide.IModelElicoide;
import mvc.model.ModelCurve;
import mvc.view.ViewCurve;


public class ViewEnhanchedElicoide3D extends ViewCurve {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	public static boolean trunkVisibility = true;
	
	private ICurve trunk;

	public ViewEnhanchedElicoide3D(ModelCurve curve, ModelCurve trunk,
			IRenderer r, Dimension d,
			String title) {
		super(curve, r, d, title);
		
		this.trunk = trunk;		
	}
	
	@Override
	public void render(ICurve curve, Graphics g) {
		super.render(curve, g);
		
		if(trunkVisibility)renderer.render(trunk, g);
		drawStringCurrentT(g);
		drawStringParameters(g); 
	}
	
	private void drawStringParameters(Graphics g) {
		if (MouseController.mousePressed) {
			//System.out.println("Foo added");
			g.drawString("R: "+getR(), 50, 70);
			g.drawString("K: "+getK(), 50, 85);
			g.drawString("U: "+getU(), 50, 100);			
		}
	}

	private void drawStringCurrentT(Graphics g) {
		g.setColor(new Color(0,0,0,140));
		g.drawString("Current t :"+getT(), 50, 50);
	}

	private String getT() {
		return df.format(model.getCurrentT());
	}

	private String getK() {
		return df.format(((IModelElicoide)model).getK());
	}

	private String getR() {
		return df.format(((IModelElicoide)model).getR());
	}

	private String getU() {
		return df.format(((IModelComplexHelix)model).getU());	
	}


}
